# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=taof
pkgver=0.3.2
pkgrel=10
pkgdesc='A GUI cross-platform Python generic network protocol fuzzer.'
url='http://taof.sf.net/'
groups=('blackarch' 'blackarch-fuzzer')
license=('GPL')
depends=('python2' 'python2-twistedx' 'python2-gobject' 'pygtk')
arch=('any')
source=("http://downloads.sourceforge.net/$pkgname/$pkgname-$pkgver.tgz")
sha512sums=('f01c77533f93f5bd462eb52e47b84c490fe939b0cf7eee6aebb0b999cf42a2d4d47a96aaeb1f6c2f518cb5b133480f47a82c2a1c541bf04178510543d431c82c')

prepare() {
  cd "$pkgname-$pkgver"

  sed -i 's|bin/env python|bin/env python2|g' "$pkgname.py"
}

package() {
  cd "$pkgname-$pkgver"

  rm *.pyc

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname/"

  cp -a --no-preserve=ownership * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python2 $pkgname.py "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

